#pragma once
#include <cv.h>
#include <highgui.h>
#include <cvaux.h>
#include <fstream>
#include <vector>
#include <map>
#include "stdafx.h"
#include "CapturingAndStoring.h"

class LearningAndRecognition
{
public:
	LearningAndRecognition(void);
	~LearningAndRecognition(void);
	void LearnAndRecognizeFace(char * argv[]);
	void CreateRecognitionTextFileWithFilePaths(std::vector<std::string> &vectorFilePaths);
	void recognize(char * argv[], std::vector<std::string> vectorFilePaths);
	int loadTrainingData(CvMat ** pTrainPersonNumMat);
	int findNearestNeighbor(float * projectedTestFace);
	int loadFaceImgArray(const char * filename);
private:
	std::wstring s2ws(const std::string &s);
	void ReadTrainingTextFile(std::map<int, std::string> &mapPersonNumName);
	bool fexists(const char * filename);
};

